package com.plian.system.task.zhibiao;

import com.plian.Tools.pagedata.PageData;
import com.plian.system.config.exception.MyRuntimeException;
import com.plian.system.dao.sys.timing.TimingDao;
import com.plian.system.service.fr.indicatorsstdvalue.IndicatorsStdvalueService;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.util.Date;

public class ZhiBiaoTask extends QuartzJobBean {
    @Autowired
    IndicatorsStdvalueService indicatorsStdvalueService;
    @Autowired
    TimingDao timingDao;
    private static final Logger log = LoggerFactory.getLogger(ZhiBiaoTask.class);
    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        try {
        indicatorsStdvalueService.calculation();
        PageData p=new PageData();
        p.put("fun","0");
        p.put("executionTime",new Date());
        timingDao.editByExecutionTime(p);
        } catch (Exception e) {
            log.error(ExceptionUtils.getFullStackTrace(e));
            throw new MyRuntimeException("指标定时任务异常");
        }
    }
}
